package com.xmy.cultivate.mapper;

import com.xmy.cultivate.entity.GradeAutoSet;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 批量添加班级设置 Mapper 接口
 * </p>
 *
 * @author hpiggy
 * @since 2025-02-24
 */
public interface GradeAutoSetMapper extends BaseMapper<GradeAutoSet> {

    /**
     *
     * @param yearPart 年份
     * @param quarterNum 学期
     * @param weekType 1周内，2周末
     * @param lessonType 2智能课，3精品课
     * @param yearClassId 年级
     * @return
     */
    @Select({"<script>",
            "SELECT",
                    "* ",
                    "FROM",
                    "grade_auto_set ",
                    "WHERE",
                    "year_part = ${yearPart} ",
                    "AND quarter_num = ${quarterNum} ",
                    "AND week_type = ${weekType} ",
                    "AND lesson_type = ${lessonType} ",
                    "AND FIND_IN_SET( ${yearClassId}, year_class_id_str ) ",
                    "ORDER BY",
                    "time_start,",
                    "time_end ASC",
            "</script>"})
    public List<GradeAutoSet> getAutoTime(@Param("yearPart") Integer yearPart,
                            @Param("quarterNum") Integer quarterNum,
                            @Param("weekType") Integer weekType,
                            @Param("lessonType") Integer lessonType,
                            @Param("yearClassId") Integer yearClassId);
}
